// 第一步导入three.js
import * as THREE from 'three';  // 导入three.js

import '../../../css/base.css'

const canvas = document.getElementById("canvas")
let renderer, scene, camera;

function initCSR() {
  camera = new THREE.PerspectiveCamera(74, window.innerWidth / window.innerHeight, 0.1, 1000)

  scene = new THREE.Scene()

  renderer = new THREE.WebGLRenderer({canvas: canvas, antialias: true});
  camera.updateProjectionMatrix();
  renderer.setPixelRatio(window.devicePixelRatio);
  renderer.setSize(window.innerWidth, window.innerHeight, false)
}

function render() {
  renderer.render(scene, camera)
}

function animation() {
  requestAnimationFrame(animation)
  render()
}

(function () {
  initCSR()
  animation()
})()

